// hdu5738
// 题意：
// 题解：
//
// run: $exec < input
#include <iostream>
#include <functional>
#include <utility>
#include <unordered_map>

using pair = std::pair<int, int>;

long long const mo = 1000000007;
int const maxn = 1007;
pair da[maxn];
int n;

template <class T>
T abs(T x) { return x < 0 ? -x : x; }

template <class T>
T gcd(T x, T y) { return !y ? x : gcd(y, x % y); };

int quick(int a, int b)
{
	if (!b) return 1;
	long long ret = quick(a, b / 2);
	ret = (ret * ret) % mo;
	if (b & 1) ret = (ret * a) % mo;
	return ret;
}

struct pair_hash
{
	std::size_t operator()(pair const& k) const
	{
		return std::hash<int>()(k.first) ^ (std::hash<int>()(k.second) << 4);
	}
};

struct pair_equal
{
	bool operator()(const pair& lhs, const pair& rhs) const
	{
		return lhs.first == rhs.first && lhs.second == rhs.second;
	}
};

std::unordered_map<pair, int, pair_hash, pair_equal> line;

int main()
{
	std::ios::sync_with_stdio(false);
	int T; std::cin >> T;
	while (T--) {
		std::cin >> n;
		for (int i = 0; i < n; i++) std::cin >> da[i].first >> da[i].second;

		int ans = 0;
		for (int i = 0; i < n; i++) {
			int same = 0;
			line.clear();
			for (int j = i + 1; j < n; j++) {
				pair tmp;
				if (da[i] == da[j]) { same++; continue; }
				else if (da[i].first == da[j].first) {
					tmp.first = 0; tmp.second = 1;
				} else if (da[i].second == da[j].second) {
					tmp.second = 0; tmp.first = 1;
				} else {
					tmp.first = da[j].first - da[i].first;
					tmp.second = da[j].second - da[i].second;
					auto g = gcd(abs(tmp.first), abs(tmp.second));
					tmp.first /= g; tmp.second /= g;
					if (tmp.first < 0) { tmp.first = -tmp.first; tmp.second = -tmp.second; }
					else if (!tmp.first) tmp.second = abs(tmp.second);
				}
				line[tmp]++;
			}

			ans += quick(2, same) - 1;
			ans %= mo;
			for (auto l : line) {
				ans += (quick(2, l.second + same) - quick(2, same)) % mo;
				ans %= mo;
			}
		}
		std::cout << ans << "\n";
	}
}

